﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace mEdit
{
    public partial class ShortcutKeys : Form
    {
        public ShortcutKeys()
        {
            InitializeComponent();

            this.KeyDown += (sender, args) => this.ShortcutKeys_KeyDown(sender, args);
            this.PreviewKeyDown += (sender, args) => this.ShortcutKeys_PreviewKeyDown(sender, args);
        }

        private void ShortcutKeys_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
                this.Close();
        }

        private void ShortcutKeys_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
                e.IsInputKey = true;
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
